package com.yang.common;

import java.io.IOException;
import java.io.Reader;

import org.apache.log4j.Logger;

import com.ibatis.common.resources.Resources;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.ibatis.sqlmap.client.SqlMapClientBuilder;
import com.yang.test.DBConnectTest;

public abstract class CommonDAO {
	public static Logger logger = Logger.getLogger(CommonDAO.class);
	protected static SqlMapClient sqlMapClient;
	    
    static {
        try {
          Reader reader = Resources.getResourceAsReader("SqlMapConfig.xml");
          sqlMapClient = SqlMapClientBuilder.buildSqlMapClient(reader);
          reader.close(); 
        } catch (IOException e) {
          // Fail fast.
          throw new RuntimeException("Something bad happened while building the SqlMapClient instance." + e, e);
        }
    }
}
